<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ice="http://www.icesoft.com/icefaces/component">

    <ui:composition template="/resources/template/TemplateEFP.xhtml">
        <ui:define name="title">
            <h:outputText value="#{bundle.CreateQuestionTitle}"></h:outputText>
        </ui:define>
        <ui:define name="body">
            <ice:form styleClass="jsfcrud_view_form">
                <div id="fromCreate">
                    <h:panelGrid columns="2">
                        <h:outputLabel value="#{bundle.CreateQuestionLabel_intitule}" for="intitule" />
                        <h:inputText id="intitule" value="#{questionController.intitule}" title="#{bundle.CreateQuestionTitle_intitule}" required="true" requiredMessage="#{bundle.CreateQuestionRequiredMessage_intitule}"/>
                        <h:outputLabel value="#{bundle.CreateQuestionLabel_type}" for="type" />
                        <ice:selectOneMenu id="type" value="#{questionController.type}" title="#{bundle.CreateQuestionTitle_type}" partialSubmit="true">
                            <f:selectItems value="#{questionController.typesAvailableSelectMany}"/>
                        </ice:selectOneMenu>
                        <h:outputText value="#{bundle.CreateQuestionLabel_propositions}"  rendered="#{questionController.type != 'Ouverte'}"/>
                        <h:panelGroup rendered="#{questionController.type != 'Ouverte'}">
                            <ice:inputText id="textePropo"  value="#{questionController.textePropo}" title="#{bundle.CreateQuestionnaireTitle_listCible}" />
                            <ice:inputText id="valeurPropo"  value="#{questionController.valeurPropo}" title="#{bundle.CreateQuestionnaireTitle_listCible}" />
                            <h:commandButton value="ajouter" action="#{questionController.ajouterProposition}" />
                            <ice:dataTable value="#{questionController.dtmPropositions}" var="propo" border="0" cellpadding="2" cellspacing="0" rules="all" rendered="#{questionController.dtmPropositions.rowCount > 0}">
                                <h:column>
                                    <h:outputText value="#{propo.valeur}" />
                                </h:column>
                                <ice:column>
                                    <ice:commandButton image="./resources/images/button/cross.png"  action="#{questionController.retirerProposition}" >
                                        <f:setPropertyActionListener target="#{questionController.laProposition}" value="#{propo}" />
                                    </ice:commandButton>
                                </ice:column>
                            </ice:dataTable>
                        </h:panelGroup>
                    </h:panelGrid>
                    <br />
                    <h:panelGroup id="messagePanel" layout="block">
                        <h:messages errorStyle="color: red" infoStyle="color: green" layout="table"/>
                    </h:panelGroup>
                    <h:commandLink action="#{questionController.create}" value="#{bundle.CreateQuestionSaveLink}" />
                    <br />
                    <h:commandLink action="#{questionController.prepareCreate}" value="#{bundle.CreateQuestionTitle}" />
                    <br />
                    <br />
                </div>
            </ice:form>
        </ui:define>
    </ui:composition>

</html>
